UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bpdN3ktAGnU/9tnoJmMfu8FhW1wIV0MVrbDnfxI2Imo='
WHERE
key_id = 'f85a353902ccd68c6377d3e21f8942cd649fd8ac3da4153943c477dacccf55bc'
AND (
token = 'bpdN3ktAGnU/9tnoJmMfu8FhW1wIV0MVrbDnfxI2Imo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)