UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7c3dLzziizCZvylhFIpxF4mO+GAaqqkreQvKv6ahMt0='
WHERE
key_id = 'b007f84e3427633539f6b4dc60818cf20072ae2f4ac3a8077be2ccf86554abd8'
AND (
token = '7c3dLzziizCZvylhFIpxF4mO+GAaqqkreQvKv6ahMt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)