UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LquvcoJY4libsepIY7S5ido4BdGbQx2rl2x+uYZGM1k=' 
WHERE 
  key_id = '6ff67c3f72a2d09ee0d92f1c69fab5b8ba80fe8e1c93361b23e6d49f903d5942' 
  AND (
    token = 'LquvcoJY4libsepIY7S5ido4BdGbQx2rl2x+uYZGM1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041