UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jph87qqQ7tj7WHk+zyczQL+MEzmwPT6I3a0o5annFHc='
WHERE
key_id = '9247572560a0fe55a07492a2179ac9a933c128fbd84435a615e0d57c737aae4c'
AND (
token = 'Jph87qqQ7tj7WHk+zyczQL+MEzmwPT6I3a0o5annFHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)