UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HD+UN4mUzvWhcSF3ka3FBRrshNlFv70tejyE1+GMuCo='
WHERE
key_id = '9f0f5859a8245920de09585426407f82519eeb761bd0ee9b3c028a971242af99'
AND (
token = 'HD+UN4mUzvWhcSF3ka3FBRrshNlFv70tejyE1+GMuCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)