UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nfQG8Ptumz4TpyrPcGCkF4q1Trx0KQclMX/iRHvT+2o=' 
WHERE 
  key_id = 'c8fd996b1f7ae72969523752095e5e9351b94ee98506be264781b6a3e54f2de7' 
  AND (
    token = 'nfQG8Ptumz4TpyrPcGCkF4q1Trx0KQclMX/iRHvT+2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017