UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SwPlkJ4D+8S2X7XFVxuGxMvRDi9loaXCxp2F1gWIE3s='
WHERE
key_id = '35b67bca29cf9ff20ded447adb3cb4b9c79f8cbacec222222ce012d7297af9a1'
AND (
token = 'SwPlkJ4D+8S2X7XFVxuGxMvRDi9loaXCxp2F1gWIE3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)