UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's8qpktrGMNNS6RTXoN5EAVZHtH/Gc1tfA6ElLvXWg/A=' 
WHERE 
  key_id = '352a90df6a05543fd5d877974fc14d7217f700d09329efe899daa4fd61349804' 
  AND (
    token = 's8qpktrGMNNS6RTXoN5EAVZHtH/Gc1tfA6ElLvXWg/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029