UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cz2JGB/ThLXmdcFoar1bfdWvBsWeTL3ZNRJo8YWLGw='
WHERE
key_id = '6be036ab9bcddabdc940c319351b2723c7e1d0c5403317b31e86c9a723c9ca29'
AND (
token = '0cz2JGB/ThLXmdcFoar1bfdWvBsWeTL3ZNRJo8YWLGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)