UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJdi4SaUF5amN3naNxJjlGB+spFgblBCnwDnkwMURCQ=' 
WHERE 
  key_id = 'f5f4cc213c16a643f8cba03a78cc7796292966d716751535a382b20a439dd79f' 
  AND (
    token = 'BJdi4SaUF5amN3naNxJjlGB+spFgblBCnwDnkwMURCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024