UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nFNFsjdfeG7rdFu5UGZm64KJTCAiOCXI3WWJfiL/9M8='
WHERE
key_id = 'f6767d6edbb6ae786c76ab06ad006c80b5ffa1455453d572aca788d68869e910'
AND (
token = 'nFNFsjdfeG7rdFu5UGZm64KJTCAiOCXI3WWJfiL/9M8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)