UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qgKMq5fASb+ZekPe00Bu/btUXpTnaA3QqgvKHqTyDeo=' 
WHERE 
  key_id = '3ffe9e479f55901d01b744e7c1b6582a84b8c6ec11c0b477936e6d335c63eac3' 
  AND (
    token = 'qgKMq5fASb+ZekPe00Bu/btUXpTnaA3QqgvKHqTyDeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031