UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uwy139BKw0VwtjWHaQ+C/OIt9IWcEmAODBbCxK2j19A=' 
WHERE 
  key_id = '6878b68fa2249e1ade39637f78c5e838579638553eb0c5a647eeacb0299de1d5' 
  AND (
    token = 'Uwy139BKw0VwtjWHaQ+C/OIt9IWcEmAODBbCxK2j19A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028