UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oBMpDFtng09nM7fS0zQtIIlo7NCb7Ozdz4hO3Ns34Bw=' 
WHERE 
  key_id = '2b129194d99c604ee34306d8cf1a6620b91383a9feae3223ee2cb66e50394797' 
  AND (
    token = 'oBMpDFtng09nM7fS0zQtIIlo7NCb7Ozdz4hO3Ns34Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030