UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gf/6HuzgVHkCANiR9iCk9fGj/k/ssWu3qJvORhAVyrg=' 
WHERE 
  key_id = '723b888bdc1cf134bcf16a265b0816eb81750ddc1224d06a4b370ed697df18c6' 
  AND (
    token = 'gf/6HuzgVHkCANiR9iCk9fGj/k/ssWu3qJvORhAVyrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051