UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i7BgPg6zXcE1g6jiOHOAQbFQXGBBGXVQH6UszGjswq8='
WHERE
key_id = '631580673e4fde464bcfd1a9eb9cdc63f858384e3d89ca87e36ce4875f440e9f'
AND (
token = 'i7BgPg6zXcE1g6jiOHOAQbFQXGBBGXVQH6UszGjswq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)