UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n/RCsHH5ZXI9ZF5ni/x6xXs/2YRu0zfeMSY+eMtE9E4='
WHERE
key_id = 'c9408cf8876389a7a4a77cfef94d381494219b76a70e098275205cb31bae63fa'
AND (
token = 'n/RCsHH5ZXI9ZF5ni/x6xXs/2YRu0zfeMSY+eMtE9E4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)