UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cfej3ul77EAaTLZn2Lcj0742ZqHHgQevwbSSfSkkbhU='
WHERE
key_id = 'a41b31d7dec3e61263b1c007445bce262cb07b7a05fdfcf38fc41f3a15996e73'
AND (
token = 'Cfej3ul77EAaTLZn2Lcj0742ZqHHgQevwbSSfSkkbhU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)