UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pPi9tPW1Bl2h6qtT0JMFVkL2+/vfeAhu+CckoVGL/uE=' 
WHERE 
  key_id = 'a88b2fd6157b179e128646d0681e14471767174392addc1868c08c120004143b' 
  AND (
    token = 'pPi9tPW1Bl2h6qtT0JMFVkL2+/vfeAhu+CckoVGL/uE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039