UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9hH5HdggPZq20iqDZg3jkxTOr3+K5khY2Xd/1nkOB/4='
WHERE
key_id = 'a1c6eb562df4a2f5692e6be8029e720494d330f9bfbc05671a7295d725e0216f'
AND (
token = '9hH5HdggPZq20iqDZg3jkxTOr3+K5khY2Xd/1nkOB/4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)