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