UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'th9ijfJ2IrCndYdyywXTS3yKwE8mW3PzYu41T9Wb8kM=' 
WHERE 
  key_id = 'a24c6ae89142afbfecd86ec450f2b0c9d853d8192b4a909449065264c24c72c6' 
  AND (
    token = 'th9ijfJ2IrCndYdyywXTS3yKwE8mW3PzYu41T9Wb8kM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032