UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3FGkcGLRCUTjbTw2il7NxbEDLyGzCC+MbPaPXjMsIB8=' 
WHERE 
  key_id = '4a7fb3313a31f6614a25171256922fcdd9d1688d883812693d733aa87d093e78' 
  AND (
    token = '3FGkcGLRCUTjbTw2il7NxbEDLyGzCC+MbPaPXjMsIB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057