UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TMhM5XwvxJVlLml4qXys/mfhXhLnS8Re6dHmft/vqRk='
WHERE
key_id = 'ccb878ac1ecf7b38087842eb35abe74f47dc49c6eb620aa5e0656829de53e8cc'
AND (
token = 'TMhM5XwvxJVlLml4qXys/mfhXhLnS8Re6dHmft/vqRk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)