UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D6njvO7rs/Fnm0iEjsvd4r8COV8LSe3SxVUXGENMkQk=' 
WHERE 
  key_id = 'c6310e51183939146d8bc4bd2d31e9a46535f6c30e764be56e99b126eadc3f97' 
  AND (
    token = 'D6njvO7rs/Fnm0iEjsvd4r8COV8LSe3SxVUXGENMkQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038