UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aWg6aSJfWfD84jPoz9GpQDP5OmHof4cbyGgVnfKQqHw='
WHERE
key_id = 'c51cffe7cbbfdd90049d37aa74a2b13b4b7e23e3046f38a40b2771ad08432f32'
AND (
token = 'aWg6aSJfWfD84jPoz9GpQDP5OmHof4cbyGgVnfKQqHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)