UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5OHfKWm8d1LePAvzDnBoYsfK0j7RJTUuV46HQamCqLA='
WHERE
key_id = '4bbc32e7868c6dcb328969331ea2e82d3a0e63d8261996259394da136d0390f6'
AND (
token = '5OHfKWm8d1LePAvzDnBoYsfK0j7RJTUuV46HQamCqLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)