UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'egeGMj6BbtBCu8p+D70eRP+8fIwobyYYx0Szwjo8ItI='
WHERE
key_id = 'dcba9e484ccfce4552c294df2162bcb8e6328266c6288c45a06e8a3edcceb23e'
AND (
token = 'egeGMj6BbtBCu8p+D70eRP+8fIwobyYYx0Szwjo8ItI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)