UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5J4nTRjv4S1eWM5UsBzJO+PXy5kqK1wVtEjduImUD3Q=' 
WHERE 
  key_id = '2d03bb1022acd8faae5c64233d8a64964728ea4c4d8b63d48c23418b024b2300' 
  AND (
    token = '5J4nTRjv4S1eWM5UsBzJO+PXy5kqK1wVtEjduImUD3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080