UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+OoxNL1mUxufaiSbDWD6syKU1kOk4b/8poRd9wGuvM8=' 
WHERE 
  key_id = '8e64b9273849e1ae828c076a203e7c22b07ff5c11793db06e9c8a126a6f4ccf3' 
  AND (
    token = '+OoxNL1mUxufaiSbDWD6syKU1kOk4b/8poRd9wGuvM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025