UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XgsokVxMTShmaH8/BWcabmRl/sD0Dtq350jRmzTFIG4='
WHERE
key_id = 'aad4a569c83c1371ebc7dfc90eef17f4b5c2cba4f703f26da56066902a7a54b8'
AND (
token = 'XgsokVxMTShmaH8/BWcabmRl/sD0Dtq350jRmzTFIG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)