UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRWYngJxfa4S/1+HNmaOFYvvlbaHY+9BB8++7HU5EIg='
WHERE
key_id = 'f4eff335025907b784e68d25587a0f18575c639493c3cac5d2ef51e3109b89a5'
AND (
token = 'xRWYngJxfa4S/1+HNmaOFYvvlbaHY+9BB8++7HU5EIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)