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