UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cuqOzOR2hlFSyUBDvFLeTk8egEi/Gp0yuYwtc15djhU=' 
WHERE 
  key_id = '057410ef923ba5f16c34629185561ac7192904135573991e5cbf00c9379b2165' 
  AND (
    token = 'cuqOzOR2hlFSyUBDvFLeTk8egEi/Gp0yuYwtc15djhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037