UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AHTPaWmeU4cUNuRGQyXVMwQCjOavx/alqTjiNsePPaM='
WHERE
key_id = 'd51953e5ce2b81e8a75e12b376c2a0294cd36b4876540a1b69d4e7f83f164e15'
AND (
token = 'AHTPaWmeU4cUNuRGQyXVMwQCjOavx/alqTjiNsePPaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)