UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9cZ2iI1W5myUYcq8ZVicrTDzG7EfDmXu0OkwV14Ne8w='
WHERE
key_id = '0c178661d9e4a845eb0ef856a7df2aac1b4726788a02b565c3c7445a567f1c04'
AND (
token = '9cZ2iI1W5myUYcq8ZVicrTDzG7EfDmXu0OkwV14Ne8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)