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

Query time 0.00048